package com.gr.staffpm.widget.jqgrid.column;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;

public class EditableGridActionsColumn<T> extends AbstractEditableGridColumn<T> {


    public EditableGridActionsColumn(IModel displayModel) {
        super(displayModel, "");
    }

    private static final long serialVersionUID = 1L;


    @Override
    public void populateItem(final Item cellItem, String componentId, IModel rowModel) {

        cellItem.add(new EditableGridActionsPanel<T>(componentId, cellItem, getGrid()) {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onSave(T object, AjaxRequestTarget target) {
                EditableGridActionsColumn.this.onSave(object, target);
            }

            @Override
            protected void onError(AjaxRequestTarget target) {
                EditableGridActionsColumn.this.onError(target);
            }

            @Override
            protected void onCancel(AjaxRequestTarget target) {

            }

            @Override
            protected void onDelete(T object, AjaxRequestTarget target) {
                EditableGridActionsColumn.this.onDelete(object, target);
            }

        });
    }

    protected void onDelete(T object, AjaxRequestTarget target) {

    }

    protected void onSave(T object, AjaxRequestTarget target) {

    }

    protected void onError(AjaxRequestTarget target) {

    }
}
